# import os
from time import sleep

from selenium import webdriver
from selenium.webdriver.common.keys import Keys#模拟键盘操作事件
from selenium.webdriver.common.by import By

# 注意【pymouse==1.0[在pymouse库的初始化方法中第92行的from windows import PyMouse,PyMouseEvent改为from pymouse.windows import PyMouse,PyMouseEvent。]】
# 注意【pyuserinput==0.1.10[自动安装hook];beautifulsoup4==4.12.3;】

import keyboard
import pymouse
# import pyperclip#【即可】
# import pandas as pd
from bs4 import BeautifulSoup
import re

driver = webdriver.Edge()
# driver.maximize_window()#最大化
driver.set_window_size(800,750)#浏览器大小


# 方法2：
driver.get("http://login.ecust.edu.cn")
# driver.get("http://172.20.3.81:802/srun_portal_pc.php?ac_id=43&usermac=3C-6A-A7-13-59-16&user%5Fip=10.101.93.54&nas%5Fip=192%2E168%2E72%2E210")#【要有http://
# driver.get("https://www.sciencedirect.com/search?qs=microfluid%20sphere")
# html_text=driver.page_source
# soup=BeautifulSoup(html_text, 'html.parser')

# # 方法4:
# url=pyperclip.paste()#成功
# driver.get(url)

sleep(1)
try:
# 账号
    driver.find_element(by=By.ID,value='username').send_keys('Y20170138')
    driver.find_element(by=By.ID,value='password').send_keys('289a289bAA')

# 点击登录
    login_user_btn=driver.find_element(By.CLASS_NAME,'bottom')#【找不到！！】
    login_user_btn.click()#自动
    print("user pass，登录按钮，成功")
except :
    print("失败，已经登录")#的确无法找到！！！



# keyboard.press_and_release('home')


sleep(3)
print("即将关闭")
driver.close()
# driver.quit()

